﻿<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#160;">
  <!ENTITY raquo "&#187;">
  <!ENTITY copy "&#169;">
  <!ENTITY laquo "&#171;">
  ]>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:xs="urn:dummy"
>

    <xsl:template match="ifie">
      <xs:text disable-output-escaping="yes">&lt;!--[if </xs:text>
        <xsl:value-of select="@test" />
        <xs:text disable-output-escaping="yes">&gt;</xs:text>
        <xsl:apply-templates select="* | text()" />
      <xs:text disable-output-escaping="yes">&lt;![endif]--&gt;</xs:text>
    </xsl:template>
    
  <xsl:template match="listbox">
    <select name="{@name}" value="{{{@field}}}">
      <xsl:for-each select="listitem">
        <option value="{@value}">
          <xs:if test="{../@field}='{@value}' or (not({../@field}) and {../@default and ../@default=@value}())">
            <xs:attribute name="selected">selected</xs:attribute>            
          </xs:if><xsl:value-of select="." />
        </option>
      </xsl:for-each>
    </select>
  </xsl:template>
  
  <!-- checkbox list -->
  <!-- access button -->
    <xsl:template match="accessbutton">
      <button>
        <xsl:variable name="text">
          <xsl:apply-templates select="* | text()" />
        </xsl:variable>
        <xsl:copy-of select="@*[name() != 'name' and name() != 'value']" />
        <xsl:attribute name="accesskey">
          <xsl:value-of select="substring(substring-after($text, '&amp;'), 1, 1)"/>
        </xsl:attribute>
        <input type="hidden" name="{@name}" value="{@value}" />
        <xsl:value-of select="substring-before($text, '&amp;')" />
        <em>
          <xsl:value-of select="substring(substring-after($text, '&amp;'), 1, 1)"/>
        </em>
        <xsl:value-of select="substring(substring-after($text, '&amp;'), 2)"/>
        
      </button>
    </xsl:template>
    
</xsl:stylesheet>
